package com.menggudf.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.menggudf.model.IllnessModel;
import com.menggudf.model.ResultModel;
import com.menggudf.service.DiagnosisService;
import com.menggudf.service.IllnessService;

/**
 * 疾病操作
 * */
@Controller
@RequestMapping("illness")
public class IllnessController {

    @Autowired
    private IllnessService illnessService;
    
    @Autowired
    private DiagnosisService diagnosisService;
    
    /**
     * 根据疾病ID获取诊疗方案
     * */
    @RequestMapping("getDiagnosisByIllnessId")
    @ResponseBody
    public ResultModel getDiagnosisByIllnessId(
            @RequestParam("illnessId") String illnessId){
        return diagnosisService.getDiagnosisByIllnessId(illnessId);
        
    }
    
    /**
     * 根据疾病ID更新诊疗方案
     * */
    @RequestMapping("updateDiagnosisByIllnessId")
    @ResponseBody
    public ResultModel updateDiagnosisByIllnessId(
            @RequestParam("illnessId") String illnessId,
            @RequestParam("scheme") String scheme){
        return diagnosisService.updateDiagnosisByIllnessId(illnessId,scheme);
        
    }
    
    /**
     * 根据疾病id获取疾病
     * */
    @RequestMapping("getIllById")
    @ResponseBody
    public IllnessModel getIllById(
            @RequestParam("id") String id){
        return illnessService.getIllnessById(id);
        
    }
    
    /**
     * 根据疾病ids获取疾病list
     * */
    @RequestMapping("getillsByIds")
    @ResponseBody
    public List<IllnessModel> getillsByIds(
            @RequestParam("ids") String ids){
        return illnessService.getillsByIds(ids);
        
    }
}
